<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
<style type="text/css">
* { margin: 0; padding: 0;}
body { font-family: "Microsoft Yahei"; background-color: #15734b;}
h1 { width: 900px; margin: 40px auto; font: 32px "Microsoft Yahei"; text-align: center; color: #fff;}
.dowebok { width: 100%; margin: 0 auto;text-align: center;}
.rotary{width: 100%;height: 65%;background: url('/assets/lottery/g_3.png') center no-repeat;background-size: contain;line-height: 65%;}
.hand{width:200px;height: 200px;}
.list h4{padding-top: 15px;color:red;text-align: center;}
.list ul { list-style-type: none; font-size: 12px; color: #fff;}
.list span { display: inline-block;margin-right:10px;font-size: 0.8em;}
.list{background: #669900;height: 23%;width: 95%;margin: 0 auto;border-radius: 5px;margin-top: 2%;padding-left: 5px;}
#conut01{color:red;}
</style>
<link rel="stylesheet" href="/assets/css/sweetalert.css">
</head>

<body>
<div class="dowebok">
	<div style="padding-top:1%;">剩余&nbsp;<span id="conut01"></span>&nbsp;次抽奖</div>
	<div class="rotary">
		<img id="js-cl-lottery-pointer" class="cl-lottery-pointer hand" src="/assets/lottery/z.png" alt="">
	</div>
	<div class="list">
		<div style="width:50%;float:left;text-align:left;">
			<h4>抽奖规则</h4>
			<ul>
				<li>
					<span>1.</span> <span>新关注用户赠送一次抽奖机会</span>
				</li>
				<li>
					<span>2.</span> <span>每次抽奖，将扣除抽奖次数</span>
				</li>
				<li>
					<span>3.</span> <span>抽奖次数可通过<span style="color:red;margin:0px;font-size:1em;">隐藏任务</span>增加</span>
				</li>
				<li>
					<span>4.</span> <span>中奖后，请如实填写个人信息</span>
				</li>
				<li>
					<span>5.</span> <span>所有奖励自中奖<span style="color:blue;margin:0px;font-size:1em;">一个月</span>内有效</span>
				</li>
			</ul>
		</div>
		<div style="width:50%;float:left;text-align:left;">
			<h4>中奖规则</h4>
			<ul>
				<li>
					<span>1.</span> <span>用户抽中数字3、6、9、12即为中奖</span>
				</li>
				<li>
					<span>2.</span> <span>数字3为一等奖，奖励试玩10次</span>
				</li>
				<li>
					<span>3.</span> <span>数字6为二等奖，奖励试玩5次</span>
				</li>
				<li>
					<span>4.</span> <span>数字9为三等奖，奖励试玩1次</span>
				</li>
				<li>
					<span>5.</span> <span>数字12为隐藏奖励，奖励需触发</span>
				</li>
			</ul>
		</div>
	</div>
	<div style="width:100%;font-size:0.4em;margin-top:1%;">
		<span style="color:blue;">更多精彩活动，请关注微信公众号“VR小贝”</span><br/>
		<span>本活动最终解释权归“苏州贝聆达网络科技有限公司”所有</span>
	</div>
</div>

<script src="/assets/js/jquery-1.10.2.min.js"></script>
<script src="/assets/js/jQueryRotate.2.2.js"></script>
<script src="/assets/js/sweetalert.min.js"></script>
<script>

	jQuery(function($){
	  var h = $(window).height();
	  $('.dowebok').css('height',h);
	  $('.hand').css('margin-top',(h*0.65/2-100)+'px');
	  wechatLottery.init();
	});
	(function($) {
	  var clicked = false;

	  var wechatLottery = {

	    init: function() {
	      this.getLatestAward();
	      this.bindLotteryEvent();
	    },
	    isRotating: false,
	    scrollWordInstance: null,
	    getLatestAward: function() {
	           var self = this;
	    },

	    bindLotteryEvent: function(){
	      var self = this;
	        $.get("http://www.51mojoy.com/home/lottery_run?action=left_time&uopenid=<?php echo $uopenid?>",function(data,status){
	        data = $.parseJSON(data);
	        count1 = data.left_draw_time;
	        $('#conut01').text(count1);
	       });
	      $('#js-cl-lottery-pointer').rotate({
	        bind: {
	          click: function() {
	          if(clicked){
	            return;
	          }
	          clicked=true;
	          if (self.isRotating) {
	            return;
	          }
	          else{
	            var rd = true;
	            $.get("http://www.51mojoy.com/home/lottery_run?action=lottery&uopenid=<?php echo $uopenid?>",function(data,status){
	              data = $.parseJSON(data);

	              count1=data.left_draw_time;
	              $('#conut01').text(count1);
	              if(data.error) {
	                  if(data.err_msg){
	                  	swal(data.err_msg);
	                  }
	                 clicked = false;
	                 return;

	              }else{
	                self.isRotating = true;
	                award = data.status;
	                $('#conut01').text(count1);
	                self.isRotating = false;
	                self.rotateFunc(award);
	              }
	            });
	          }
	        }
	        }
	      });
	    self.resetAngle();
	    },

	    rotateFunc: function (award) {
	      $('#js-cl-lottery-pointer').stopRotate();
	      $('#js-cl-lottery-pointer').rotate({
	        angle: 0,
	        duration: 5000,
	        animateTo: award.angle + 360 * 4,
	        callback: function() {
	          if (award.callback) {
	            award.callback();
	          }

	          swal(award.text);
	          $('body').css({'overflow':'hidden'});
	          clicked = false;

	        }
	      });
	    },
	    resetAngle: function() {
	      $('#js-cl-lottery-pointer').rotate({
	        angle: 0,
	        duration: 1,
	        animateTo: 359,
	        callback: function() {
	          $('#js-cl-lottery-pointer').removeClass('invisible');
	        }
	      });
	    }
	  };
	  window.wechatLottery = wechatLottery;
	})(jQuery);


</script>

</body>
</html>